/**
 *
 */
package asa;

/**
 * 	ParaStat ::= "para" Ident "=" Expr "até" Expr "faça"
                   		StatList

 * @author José
 *
 */
public class ParaStat extends Statement {

	public ParaStat(Variable v, Expr from, Expr to,
			CompositeStatement compositeStatement) {
		this.v = v;
		this.from = from;
		this.to = to;
		this.compositeStatement = compositeStatement;
	}
    @Override
	public void genJava(PWInterface pw) {
		genJava(pw, null);
	}
	@Override
	public void genJava(PWInterface pw, Env env) {
		// TODO Auto-generated method stub
    	pw.printIdent("for ( " + v.getName() + " = ");
    	from.genJava(pw);
    	pw.print("; " + v.getName() + " <= ");
    	to.genJava(pw);
    	pw.print("; " + v.getName() + "++) ");
    	compositeStatement.genJava(pw, null);
	}

	private Variable v;
	private Expr from, to;
	private CompositeStatement compositeStatement;

}
